﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using websoniBO;

namespace websoni.Adminpages
{
    public partial class WebForm9 : System.Web.UI.Page
    {
        Fan f = new Fan();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
            DataTable dt = f.GetRecords(-99, "", "", "", false, " and ");
            GridView1.DataSource = dt;
            GridView1.DataBind();
                }
        }

        protected void Button1_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DataTable d1 = f.GetRecords(Convert.ToInt64(e.CommandArgument), "", "", "", false, " and ");
                f.fid = Convert.ToInt64(d1.Rows[0]["fid"].ToString());
                f.fanname = d1.Rows[0]["fanname"].ToString();
                f.fanphoto = d1.Rows[0]["fanphoto"].ToString();
                f.fdesc = d1.Rows[0]["fdesc"].ToString();
                f.isdeleted = true;
                f.SaveRecords();
                Response.Redirect("~/Adminpages/AFanpage.aspx");
            }
        }

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            GridView1.PageIndex = e.NewPageIndex;
            DataTable dt1 = f.GetRecords(-99, "", "", "", false, " and ");
            GridView1.DataSource = dt1;
            GridView1.DataBind();
        }
    }
}
